<%-- 
    Document   : ajouter-employe
    Created on : 3 juin 2012, 15:56:05
    Author     : TaKeO
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="../css/style.css" />
        <title>Ajouter un employé</title>
    </head>
    <body>        
    <div id="container">
        <div id="header">
            <%@include file="template/header.jsp" %>
        </div>
        <div id="center-layout">
            <div id="content">
                <h1>Ajouter un employé</h1>
                <form method="POST" name="form" class="form-horizontal">
                    <fieldset>
                        
                        <p class="error">
                            <c:forEach items="${errors}" var="error">
                                <c:out value="${error}"/>
                                <br />
                            </c:forEach>
                        </p>
                        
                        <div class="control-group">
                            <label class="control-label" for="type">Choisir le type d'employé :</label>
                            <div class="controls">
                                <select id="type" name="type">
                                    <c:forEach items="${types}" var="type">
                                        <c:choose>
                                            <c:when test="${type.id_type_employe eq employe.type_employe.id_type_employe}">
                                                <option selected="true" value="${type.id_type_employe}">${type.libelle}</option>
                                            </c:when>
                                            <c:otherwise>
                                                <option value="${type.id_type_employe}">${type.libelle}</option>
                                            </c:otherwise>
                                        </c:choose>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                        
                        <div class="control-group">
                            <label class="control-label" for="nom">Nom de l'employé :</label>
                            <div class="controls">
                                <input type="text" name="nom" value="${employe.nom}">
                            </div>
                        </div>
                        
                        <div class="control-group">
                            <label class="control-label" for="prenom">Prénom de l'employé :</label>
                            <div class="controls">
                                <input type="text" name="prenom" value="${employe.prenom}">
                            </div>
                        </div>
                        
                        <div class="control-group">
                            <label class="control-label" for="code">Code d'accès :</label>
                            <div class="controls">
                                <input type="text" name="code" value="${employe.code_acces}">
                            </div>
                        </div>
                        
                        <div class="control-group">
                            <label class="control-label" for="resto">Choisir le restaurant de l'employé :</label>
                            <div class="controls">
                                <select id="resto" name="resto">
                                    <c:forEach items="${restos}" var="resto">
                                        <c:choose>
                                            <c:when test="${resto.id_restaurant eq employe.resto.id_restaurant}">
                                                <option selected="true" value="${resto.id_restaurant}">${resto.nom}</option>
                                            </c:when>
                                            <c:otherwise>
                                                <option value="${resto.id_restaurant}">${resto.nom}</option>
                                            </c:otherwise>
                                        </c:choose>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                        
                        <div class="control-group">
                            <div class="controls">
                                <c:choose>
                                    <c:when test="${not empty employe}">
                                        <input type="submit" value="Editer l'employé" class="btn-primary"/>
                                    </c:when>
                                    <c:otherwise>
                                        <input type="submit" value="Créer l'employé" class="btn-primary"/>
                                    </c:otherwise>
                                </c:choose>
                            </div>
                        </div>
                    </fieldset>
                </form>                                    
            </div>
        </div>
            <div id="right-layout">
                
            </div>
            <div id="left-layout">
                <%@include file="template/left-layout.jsp" %>
            </div>
    </div>
    </body>
</html>
